在Linux系统下访问Windows文件 & 利用Windows Explorer访问Linux文件 | 您所在的位置:网站首页 › linux 直接访问地址命令 › 在Linux系统下访问Windows文件 & 利用Windows Explorer访问Linux文件 |
如何在 Windows 或 Ubuntu 里互相访问两边的文件呢? 这里我使用的是WSL2来运行Linux环境,如果对WSL不了解的小伙伴,可以查看下面来源于WSL2: Developer's Guide to Windows Subsystem for Linux 2 - SitePoint的一段解释: The Windows Subsystem for Linux (WSL) lets developers run a Linux environment directly on Windows 10. It’s an unmodified OS, but highly integrated into Windows and without the overhead of a virtual machine. WSL1 was groundbreaking and translated Linux system calls to Windows equivalents. This could be slow and several features weren’t available. WSL2 uses Hyper-V virtual machine technology so Linux compatibility is excellent and file access is up to 20x faster than before. 此外,还推荐这篇博文来增加对OS的理解:windows10下使用Ubuntu子系统_lifanxin的博客-CSDN博客_windows子系统ubuntu用法 接下来,我们可以在Microsoft Store中安装任意的 Linux 发行版,比如 Ubuntu、Debian、SUSE、Kali 和 Alpine,我使用的是Ubuntu。此外,我推荐使用Windows Terminal来便捷地运行不同的终端。 1. 在Linux系统下访问Windows文件打开Ubuntu终端,使用下面的命令访问到Windows系统中的文件。运行完下面这行命令,你会进入根目录下的mnt(mnt是mount的缩写)。不出意外的话,使用ls命令,你就可以看到c盘了,之后你就可以访问到Windows系统下的文件。并且,你可以使用在Linux CLI来操作Windows文件(这里,注意偶尔要使用sudo超级用户权限哦)。 cd /mnt/linux下的mnt文件夹用来干嘛,Linux/mnt目录主要用于什么?_Killer Seven的博客-CSDN博客 了解更多有关于linux下的文件夹作用,请访问上面的🔗。 2. 利用Windows Explorer访问Linux文件OK,现在我们已经可以轻松地访问window系统下的文件了,那么现在,如何反过来在Windows OS下访问Linux文件呢? 一个简单的方法,首先,我们可以先在Ubuntu终端中输入 cd ~/ explorer.exe用来打开Windows explorer,或者,手动打开\\wsl$\Ubuntu\home\${username}也行。 现在,我们已经可以访问到Linux文件了。 使用VS Code访问Linux文件此外,你还可以选择使用VS Code这个好用的软件来直接打开Linux文件。 code xxx.py结束啦,现在你已经可以轻松地在 Windows 或 Ubuntu 里互相访问两边的文件了。 |
CopyRight 2018-2019 实验室设备网 版权所有 |